import Foundation

// 测试中元节日期
func main() {
    let calendar = Calendar.current
    
    // 测试2025年中元节 - 农历七月十五
    // 先测试几个可能的日期
    let testDates = [
        DateComponents(year: 2025, month: 8, day: 9),   // 8月9日
        DateComponents(year: 2025, month: 8, day: 10),  // 8月10日
        DateComponents(year: 2025, month: 8, day: 11),  // 8月11日
        DateComponents(year: 2025, month: 8, day: 12),  // 8月12日
    ]
    
    print("=== 2025年中元节测试 ===")
    
    for testDate in testDates {
        if let date = calendar.date(from: testDate) {
            let weekday = calendar.component(.weekday, from: date)
            let weekdayNames = ["周日", "周一", "周二", "周三", "周四", "周五", "周六"]
            
            // 获取农历信息
            let lunarDate = ChineseCalendarHelper.lunarDate(for: date)
            let festival = ChineseCalendarHelper.chineseFestival(for: date)
            
            print("日期: \(testDate.year ?? 0)年\(testDate.month ?? 0)月\(testDate.day ?? 0)日")
            print("  星期: \(weekdayNames[weekday - 1])")
            print("  农历: \(lunarDate)")
            print("  节日: \(festival ?? "无")")
            print("")
        }
    }
}

main()